package com.pap.rocketmq.controller;

import com.pap.rocketmq.entity.Mq;
import com.pap.rocketmq.service.IMqService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.UUID;

@RestController
@RequestMapping("")
public class MqController {

    private static Logger logger = LoggerFactory.getLogger(MqController.class);

    @Resource(name = "mqService")
    private IMqService mqService;

    @RequestMapping(value = "/create")
    public boolean create(@RequestParam String name, @RequestParam String iCounter) {
        Mq mq = new Mq();
        mq.setName(name + ":" + iCounter);
        boolean boo = mqService.create(mq);
        logger.info("create returnBoolean : [{}][{}]", name + ":" + iCounter, boo);
        return boo;
    }

}
